package com.example.springredisdemo.listener;

import org.springframework.stereotype.Component;

import java.util.concurrent.TimeUnit;

@Component
public class RedisMessageListener implements MessageDelegate {

    private String channel = "test";

    @Override
    public void onMessage(String message,String channel) {
        try {
            TimeUnit.SECONDS.sleep(1);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        System.out.println("mesage:"+message+";channel:"+channel);
    }

    @Override
    public String getChannel() {
        return channel;
    }

}
